<template>
<div class="mui-content mui-row">
    <!--<heade background='' title='四 川 课 程 资 源'></heade>-->
  <div class="personWrapper mui-text-center">
    <div class="content">
      <!--<img src=../../static/img/wdps.png alt="">-->
      <img :src=myInfo.Head alt="">
      <div class="user">{{myInfo.Nick}}</div>
    </div>

  </div>
  <PersonInfo
    v-if="myExamineShow"
    :path="zcDomain +'static/img/shenpi.png'"
    title="我的审批"
    phone=""
    @goTo="myExamine($event)"
  >
  </PersonInfo>
    <PersonInfo
      :path="zcDomain +'static/img/shenbao.png'"
      title="我的申报"
      phone=""
      @goTo="apply($event)"
    >
  </PersonInfo>
  <PersonInfo
    :path="zcDomain +'static/img/zhengshu.png'"
    leftClass="red mui-icon-chatboxes"
    title="我的证书"
    phone=""
    @goTo="cert($event)"
  >
  </PersonInfo>
  <PersonInfo
    :path="zcDomain +'static/img/wdsc.png'"
    leftClass="red mui-icon-chatboxes"
    title="我的收藏"
    phone=""
    @goTo="collect($event)"
  >
  </PersonInfo>
  <PersonInfo
    :path="zcDomain +'static/img/wdzy.png'"
    leftClass="green mui-icon-chatboxes"
    title="我的浏览"
    phone=""
    @goTo="eyes($event)"
  >
  </PersonInfo>
  <PersonInfo
    :path="zcDomain +'static/img/ghbd.png'"
    leftClass="blue mui-icon-chatboxes"
    title="更换绑定"
    :phone=myInfo.Tele
    text="当前手机号："
    @goTo="change($event)"
  >
  </PersonInfo>
  <div class="mui-bottom bottom">
    <Foot></Foot>
  </div>
  <!--错误提醒-->
  <Prompt
    title="错误"
    :msg=mistakeMsg
    confirm="确定"
    v-on:confirm1="confirm1($event)"
    v-if="mistake"
  >
  </Prompt>
  <Confirm
    :titleConfirm=titleConfirm
    :msgConfirm=msgConfirm
    v-on:sure="sure($event)"
    v-on:giveUp="giveUp($event)"
    v-if="isCofirm"
  >
  </Confirm>
</div>

</template>
<script>
import heade from '@components/common/head2.vue'
import PersonInfo from '@components/common/PersonInfo.vue'
import Prompt from '@components/common/Prompt.vue'
import Foot from '@components/common/Foot.vue'
import  Confirm from '@components/common/Confirm.vue'

export default {
    components:{
       heade,
      PersonInfo,
      Foot,
      Prompt,
      Confirm
    },
  data(){
     return{
       UserId:'',
       mistake:false,
       myInfo:{},
       zcDomain:this.$Global.zcDomain,
       mistakeMsg:'',
       titleConfirm:'',
       msgConfirm:'',
       isCofirm:false,
       myExamineShow:false,
     }
  },
  created(){

    this.myExamineData()
    let me=this
    me.$Global.zcServer.Post({
      IsNeedLogin:'false',
      Paras:{
        Name:'Vue_CourseResource',
        Action:'MyHead',
        UserId:me.$Global.UserId ,
        Data:{
          UserId:me.$Global.UserId
        }
      },
      Callback:me.Callback_MyHead,
      Scope:me
    });

  },
  methods:{

    myExamineData(){
      let me=this
      me.$Global.zcServer.Post({
        IsNeedLogin:'true',
        Paras:{
          Name:'Vue_CourseResource',
          Action:'getCanReviewCert',
          UserId:me.$Global.UserId ,
          Data:{
            UserId:me.$Global.UserId
          }
        },
        Callback:me.cb_myExamineData,
        Scope:me
      });
    },
    cb_myExamineData(resJson,scope){
        console.log('权限',resJson)
      if(resJson.success){
        this.myExamineShow=resJson.data
      }
    },

    Callback_MyHead(resJson,req){
      console.log( '个人信息');
      console.log( resJson);
      if(resJson.success==true){
        this.myInfo=resJson.data
        sessionStorage.setItem('myName',this.myInfo.Nick)
        sessionStorage.setItem('myRegphone',this.myInfo.Tele)
      }else {
        if(resJson.msg.indexOf("PleaseRegistry")>=0){
          this.isCofirm=true;
          this.titleConfirm='提醒'
          this.msgConfirm='请先注册！'
        }else {
          this.mistake=true;
          this.mistakeMsg=resJson.msg
        }
      }

    },
    confirm1(){
      this.mistake=false
    },
    giveUp(){
      this.isCofirm=false
    },
    sure(){
      this.isCofirm=false;
      this.$router.push('/Regist')
    },
    myExamine(){
      this.$router.push('/myExamine')
    },
    apply(index){
      this.$router.push('/Apply')
    } ,
    cert(index){
      this.$router.push('/Cert')
    } ,
    collect(){
      this.$router.push('/Collect')
    },
    eyes(){
      this.$router.push('/Eyes')
    },
    change(){
      this.$router.push('/Change')
    },

  }

}
</script>
<style scoped>
.mui-content .personWrapper {
  background: url('../assets/img/bg.png') ;
  height: 27vh;
  width: 100%;
  overflow: hidden;

}
  .mui-content .personWrapper .content{
    width: 12rem;
    height: 8rem;
    margin: 2rem auto;

  }
.mui-content .personWrapper .content img{
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
}
.mui-content .personWrapper .content .user{
  margin-top: 0.3rem;
  font-size: 1.2rem;
  color:white ;
  /*width: 50%;*/
}
  .mui-content .bottom{
    width: 100%;
    position: absolute;
    display: inline-block;
    bottom: 0px;

  }

</style>

